package com.study.talk.module.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.study.talk.module.entity.vo.GroupInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

/**
 * <p>
 * 
 * </p>
 *
 * @author thor
 * @since 2023-12-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("group_info")
@ApiModel(value = "GroupInfo对象", description = "")
public class GroupInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("群聊id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("创建群聊用户id")
    private Integer mainUser;

    @ApiModelProperty("群聊名称")
    private String name;

    @ApiModelProperty("群聊图片地址")
    private String avatar;

    @ApiModelProperty("群聊背景图片")
    private String bgImg;

    @ApiModelProperty("群聊标签")
    private String tag;

    @ApiModelProperty("群聊介绍")
    private String introduce;

    @TableLogic
    @ApiModelProperty("群聊状态")
    private Integer status;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    public GroupInfo(GroupInfoVo groupInfoVo) {
        this.name = groupInfoVo.getName();
        this.avatar = groupInfoVo.getAvatar();
        this.bgImg = groupInfoVo.getBgImg();
        this.tag = groupInfoVo.getTag();
        this.introduce = groupInfoVo.getIntroduce();
        this.mainUser = groupInfoVo.getMainUser();
    }
}
